<template>
    <van-nav-bar title="搜索" />
    <van-search @click="onclk" placeholder="请输入搜索关键词" clearable style="width: 100%;" />
    <van-button type="default">搜索</van-button>

    <van-card v-for="(v, i) in list" :key="i" num="2" :title="v.goods_name"
        :thumb="goods_small_logo ? goods_small_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />

</template>

<script setup>
import { ref, watch } from 'vue'
import { searchApi } from '@/api/api';

let list = ref([])
const search = () => {
    searchApi().then(res => {
        list.value = res.data.message.goods
    })
}
search()
let title=ref('')
setTimeout(() => {
    watch(title, (newValue, oldValue) => {
        search()
    })
},1000)



</script>

<style lang="scss" scoped></style>